//
//  BMHWithdrawalTableViewCell.m
//  BMHVideoMain
//
//  Created by 爆米花 on 2017/8/9.
//  Copyright © 2017年 BAOMIHUA.COM. All rights reserved.
//

#import "BMHWithdrawalTableViewCell.h"
#import "BMHWithdrawalListModel.h"

@implementation BMHWithdrawalTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.backgroundColor = [UIColor clearColor];
        [self interfaceView];
    }
    return self;
}

- (void)interfaceView {
    _timeLabels = [[UILabel alloc]init];
    _timeLabels.font = [UIFont systemFontOfSize:14];
    [self.contentView addSubview:_timeLabels];
    
    _moneyLabels = [[UILabel alloc]init];
    _moneyLabels.font = [UIFont systemFontOfSize:14];
    //_moneyLabels.textColor = HEXCOLOR(0x9c9c9c);
    [self.contentView addSubview:_moneyLabels];

    _statusLabels = [[UILabel alloc]init];
    _statusLabels.textColor = XLTitleCOlor;
    _statusLabels.font = [UIFont systemFontOfSize:14];
    [self.contentView addSubview:_statusLabels];

    [_timeLabels mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.contentView.mas_centerY);
        make.left.equalTo(self.contentView.mas_left).offset(15);
        make.size.mas_equalTo(CGSizeMake(140, 20));
    }];
    
    
    [_moneyLabels mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.contentView.mas_centerY);
        make.left.equalTo(self.timeLabels.mas_right).offset(40);
        make.height.equalTo(@20);
    }];
    
    [_statusLabels mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.contentView.mas_centerY);
        make.right.equalTo(self.contentView.mas_right).offset(-12);
        make.height.equalTo(@20);
    }];
    
    
}

- (void)setWithdrawalModel:(BMHWithdrawalListModel *)withdrawalModel {
    _withdrawalModel = withdrawalModel;
    if (withdrawalModel) {
        
        NSString * createTimeStr =  [withdrawalModel.createTime stringByReplacingOccurrencesOfString:@"T" withString:@" "];
        _timeLabels.text = createTimeStr;
        _timeLabels.textColor = XLTitleCOlor;
        
        if (withdrawalModel.status == 1) {
            _statusLabels.text = @"申请中";
            //_statusLabels.textColor = HEXCOLOR(0x689dff);
            _moneyLabels.text = [NSString stringWithFormat:@"- %0.2f元",[withdrawalModel.actualCash floatValue]];
            _moneyLabels.textColor = RGB_HEX(0x44dbb5e);
            
        }else if (withdrawalModel.status == 2) {
            _statusLabels.text = @"提现成功";
            _moneyLabels.text = [NSString stringWithFormat:@"- %0.2f元",[withdrawalModel.actualCash floatValue]];
            _moneyLabels.textColor = RGB_HEX(0x44dbb5e);
            
        }else if (withdrawalModel.status == 3) {
            _statusLabels.text = @"提现失败";
            _moneyLabels.text = [NSString stringWithFormat:@"- %0.2f元",[withdrawalModel.actualCash floatValue]];
            _moneyLabels.textColor = RGB_HEX(0x44dbb5e);
            
        }
        
    }
    
}


- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
